package com.itheima.controller;

import com.itheima.R;
import com.itheima.dto.statusParamDto;
import com.itheima.service.OmsCompanyAddressService;
import com.itheima.service.OmsOrderReturnApplyService;
import com.itheima.vo.MinioVo;
import com.itheima.vo.ReturnApplyListVo;
import com.itheima.vo.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 芝士雪豹
 * @create 2022/10/15/0:32
 */

@RestController
@RequestMapping("/returnApply")
public class OmsOrderReturnApplyController {
    @Autowired
    private OmsOrderReturnApplyService service;

    //批量删除退货申请
    @PostMapping("/delete")
    public MinioVo delete(Integer[] ids) {
        MinioVo vo = service.delete(ids);
        return vo;
    }

    //分页查询退货申请
    @GetMapping("list")
    public R list(ReturnApplyListVo vo) {
        PageResult pageResult = service.List(vo);
        return R.success(pageResult);
    }

    //修改退货申请状态
    @PostMapping("/update/status/{id}")
    public MinioVo update(@PathVariable Integer id, @RequestBody statusParamDto dto) {
        MinioVo vo = service.updateStatus(id, dto);
        return vo;
    }

    //获取退货申请详情
    @GetMapping("/{id}")
    public R findById(@PathVariable Integer id) {
        MinioVo vo = service.findById(id);
        return R.success(vo);
    }


}
